<?php
/**
 * File : ViewUser.php
 * Created by Ludovic Reenaers
 * Created on  20 oct. 2010
 * lreenaers@hotmail.com
 */
class ViewUser extends View{
	function password($url){
		$this->redirect($url);
	}
	function reset($generator){
		if (!is_null($generator)&& is_a($generator, 'Generator')){
			$this->setContent($generator->dump());
		}else{
			$this->redirect($_SESSION['config']->controler.'?/homepage/show/');
		}
	}
	function insert($str){
		if($_SESSION["FormManager"]->hasError()){
			$this->redirect($_SESSION['config']->controler."?/user/add/");
		}else{
			$this->redirect($_SESSION['config']->controler."?/homepage/show/");
		}
	}
	function update($str){
		if($_SESSION["FormManager"]->hasError()){
			//$this->setContent("had error".$_SESSION['FormManager']->dumpErrors());
			$this->redirect($_SESSION['config']->controler."?/user/edit/");
		}else{
			
			$this->redirect($_SESSION['config']->controler."?/homepage/show/");
			//$this->setContent("had no error");
		}
	}
	function add($generator){
		$this->setContent($generator->dump());
	}
	function edit($generator){
		$this->setContent($generator->dump());
	}
	function authenticate($bool){
		if($bool){
			
			$this->redirect($_SESSION['config']->controler."?/homepage/show/");
		}else{
			$this->redirect($_SESSION['config']->controler."?/login/show/");
		}

	}
	function logout($bool){
		$this->redirect($_SESSION['config']->controler."?/homepage/show/");
	}
}
?>